<?php

	$val['id']				= $this->oRestaurant->id;
	$val['name']			= $this->oRestaurant->name;
	$val['image']			= $this->oRestaurant->image;
	$val['description']		= $this->oRestaurant->description;
	$val['delivery_cost']	= $this->oRestaurant->delivery_cost;
	
//	print_r($this->oCuisines);
?>
<form action="/adminarea/editrestaurant" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" value="<?php  if (isset($val['id'])) echo $val['id'];?>" />
	<input type="hidden" name="old_image" value="<?php  if (isset($val['image'])) echo $val['image'];?>" />

	<div class="hdr">Restaurant Information</div>
		<div class="cleft">
<p>
			<div>
				<em class="required">*</em>
				<label for="name">Restaurant Name</label>
				<input type="text" value="<?php  if (isset($val['name'])) echo $val['name'];?>" name="name" id="name" maxlength="255" tabindex="1" />
			</div>
			<?php if(isset($this->aError['name'])) { foreach($this->aError['name'] as $ErrName => $ErrDescr) { ?>
				<div class="error_msg"><?php echo $ErrDescr; ?></div>
			<?php } } ?>

			<div>
				<em class="required">*</em>
				<label for="delivery_cost">Delivery cost</label>
				<input type="text" value="<?php  if (isset($val['delivery_cost'])) echo $val['delivery_cost'];?>" name="delivery_cost" id="delivery_cost" maxlength="255" tabindex="2" />
			</div>
			<?php if(isset($this->aError['delivery_cost'])) { foreach($this->aError['delivery_cost'] as $ErrName => $ErrDescr) { ?>
				<div class="error_msg"><?php echo $ErrDescr; ?></div>
			<?php } } ?>

<?php if ('' != ($val['image'])) {?>
			<div>
				<label for="image" >Current image</label>
				<img src="/i/restaurants_logo/<?php echo substr($val['image'], 1);  ?>" />
			</div>
<?php }?>
			<div>
				<label for="image" >Image</label>
				<input type="file" name="image" id="image" maxlength="255" tabindex="2" />
			</div>
			<?php if(isset($this->aError['image'])) { foreach($this->aError['image'] as $ErrName => $ErrDescr) { ?>
				<div class="error_msg"><?php echo $ErrDescr; ?></div>
			<?php } } ?>

			<div>
				<em class="required">*</em>
				<label for="description" >Description</label>
				<textarea name="description" id="description" cols="80" rows="20" tabindex="3" ><?php if (isset($val['description'])) echo $val['description'];?></textarea>
			</div>
			<?php if(isset($this->aError['description'])) { foreach($this->aError['description'] as $ErrName => $ErrDescr) { ?>
				<div class="error_msg"><?php echo $ErrDescr; ?></div>
			<?php } } ?>

</p>

<p>
			<div>
				<label for="cuisine" >Cuisines</label>
				<ul>
					<?php

					foreach($this->allCuisines as $cuisine)
					{
						echo "\n\t" . '<li><input type="checkbox" name="cuis[' . $cuisine->id . ']" ' .
											( in_array($cuisine->id, $this->needCuisines) ? 'checked="checked"' :'') .
											'> ' .  $cuisine->name .
											'</li>';
					}

					?>
				</ul>
			</div>
</p>

<p>
			<input class="sexybutton sexysimple sexymagenta" type="submit" value="Save" /></input>
</p>
		</div>
</form>